<#import "/spring.ftl" as s/>
<@override name="main">
<div id="account_form_div">
	<form action="<@s.url '/account/save'/>" id="account_form" method="post">
		<table art="form" columns="90,*" autoLabel="true" rightAlign="true" colon="true">
			<tr>
				<td>
					<input type="hidden" id="account_id" name="id" value="${account.id}">
					<label art='label' for="login" required='true'><@s.message "account.from.login"/></label>
				</td>
				<td>
                    <#if account.id != 0>
                    ${account.login}<input type="hidden" id="login" name="login" value="${account.login?html}">
                    <#else>
                        <input id="login" name="login"   type="text" art="textbox"    validType="length[0,30]" display='right'
                               requiredMsg="<@s.message "account.edit.name.required.error.tip"/>"
                               errorMsg="<@s.message "account.edit.login.error.tip"/>"
                               emptyText="<@s.message "account.from.login"/>" required="true"/>
                    </#if>
				</td>
			</tr>
			<tr>
				<td>
					<label for="name" art='label' required='true'><@s.message "account.from.name"/></label>
				<td>
					<input id="name" name="name" required='true'
						   value="${account.name?html}"     validType="length[0,30]" display='right'
						   type="text"  art="textbox"
                           requiredMsg="<@s.message "account.edit.login.required.error.tip"/>"
                           errorMsg="<@s.message "account.edit.name.error.tip"/>"
						   emptyText="<@s.message "account.from.name"/>" required="true"/>
				</td>
			</tr>
			<tr>
				<td>
					<label for="mail" art='label' required='true'><@s.message "account.from.mail"/></label>
                </td>
				<td>
					<input id="mail" name="mail" type="text"  art="textbox"
						   value="${account.mail?html}"   validType="email"     validType="length[0,60]" display='right'
                           requiredMsg="<@s.message "account.edit.mail.required.error.tip"/>"
                           errorMsg="<@s.message "account.edit.mail.error.tip"/>"
						   emptyText="<@s.message "account.from.mail"/>" required="true"/>
				</td>
			</tr>
            <tr>
                <td><label art="label" required="true"><@s.message "account.from.identify"/></label></td>
                <td><span><input type="checkbox" value="1" name="user_roles"><@s.message 'account.from.identify.value.1'/></span>&nbsp;&nbsp;
                    <span><input type="checkbox" value="3" name="user_roles"><@s.message 'account.from.identify.value.3'/></span>&nbsp;&nbsp;
                    <span><input type="checkbox" value="2" name="user_roles" ><@s.message 'account.from.identify.value.2'/></span> </td>
            </tr>
			<tr>
				<td></td>
				<td>
					<button type="submit" id ="btn_submit" icon="account_save">
						     <span><span> <@s.message "operation.save"/> </span></span>
					</button>
				</td>
			</tr>
            <tr id='tr_form_msg'>
                <td colspan="2"></td>
            </tr>
            <tr>
                <td><input id= "roleList" type="hidden" name="roleList" value="${roleList}"></td>
            </tr>
		</table>
	</form>
</div>

</@override>
<@override name="scripts">
<script type="text/javascript" src="<@s.url '/resources/scripts/account/edit.js'/>"></script>
</@override>
<#if account.id==0>
	<#assign title="account.location.add"/>
<#else>
	<#assign title="account.location.edit"/>
</#if>
<@extends name="/common/layout.ftl" current="users" title='${title}'></@extends>